//
//  ObjectiveCard.m
//  Risiko
//
//  Created by Murgia Giovanni on 07/07/11.
//  Copyright 2011 __MyCompanyName__. All rights reserved.
//

#import "ObjectiveCard.h"


@implementation ObjectiveCard
-(id) initWithObjectiveType:(NSString*) aType 
		   andObjectivename:(NSString*) aName
			  allContinents:(NSSet*) aContinentSet{
	[super init];
	objective=aName;
	objectiveType=aType;
	continentSet = aContinentSet;
	return self;
}
-(Boolean) isGot: (NSSet*) aCountrySet{
	if ([objectiveType isEqualToString:CONQUISTA]){
		for (Player * p in playerSet){
			if ([[p getColor]isEqualToString: objective])//quando un giocatore perde tutte le armate viene deallocato e rimosso dal set!
				return FALSE;
		}
		return TRUE;
	}
	else {
		if ([objective isEqualToString:EIGHTEEN])
			return [aCountrySet count]>=18;
		if ([objective isEqualToString:TWENTYFOUR])
			return [aCountrySet count]>=24;
		if ([objective isEqualToString:EUROPAOCEANIA_1])
			return false;
		if ([objective isEqualToString:NORDAMERICAAFRICA])
            return false;
		if ([objective isEqualToString:NORDAMERICAOCEANIA])
            return false;
		if ([objective isEqualToString:ASIASUDAMERICA])
            return false;
		if ([objective isEqualToString:EUROPAOCEANIA_1])
            return false;
		if ([objective isEqualToString:ASIAAFRICA])			
            return false;
		if ([objective isEqualToString:EUROPASUDAMERICA_1])
            return false;
	}	

}

@end
